package Windows;

import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.Panel;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.Socket;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

public class new_login extends JFrame implements ActionListener {
	
	private Socket s;
	Label l1, l2, l3, l4, l5, l6;
	TextField id1, id2, user, mima1, mima2, qrmm;
	Button btn1, btn2, btn3;

	public new_login(Socket s) {
		
		this.s = s;
		
		JFrame frame1 = new JFrame("登录界面");
		frame1.setSize(450, 300);
		frame1.setLayout(null);
		frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame1.setLocationRelativeTo(null);

		Panel p1 = new Panel();
		p1.setSize(200, 200);

		frame1.add(p1, "Center");
		p1.setLayout(new FlowLayout());

		l1 = new Label("id号");
		l2 = new Label("密码");

		id1 = new TextField(15);
		id2 = new TextField(15);
		mima1 = new TextField(15);
		mima1.setEchoChar('*');
		mima2 = new TextField(15);
		user = new TextField(15);

		qrmm = new TextField(15);
		btn1 = new Button("登录");
		btn1.addActionListener(this);
		btn2 = new Button("注册");
		btn2.addActionListener(this);
		btn3 = new Button("确认");
		btn3.addActionListener(this);

		p1.add(l1);
		p1.add(id1);
		p1.add(l2);
		p1.add(mima1);
		p1.add(btn1);
		p1.add(btn2);

		frame1.setVisible(true);

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource().equals(btn2)) {
			JFrame frame2 = new JFrame("注册界面");
			frame2.setSize(450, 300);
			frame2.setLayout(null);
			frame2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
			frame2.setLocationRelativeTo(null);
			frame2.dispose();
			Panel p2 = new Panel();
			p2.setSize(205, 200);
			frame2.add(p2, "Center");
			p2.setLayout(new FlowLayout());
			l3 = new Label("id");
			l6 = new Label("昵称");
			l4 = new Label("密码");
			l5 = new Label("确认密码");
			btn3 = new Button("确认");
			btn3.addActionListener(this);
			p2.add(l3);
			p2.add(id2);
			p2.add(l6);
			p2.add(user);
			p2.add(l4);
			p2.add(mima2);
			p2.add(l5);
			p2.add(qrmm);
			p2.add(btn3);
			frame2.setVisible(true);
		}
	}
	
	

	public TextField getId1() {
		return id1;
	}

	public void setId1(TextField id1) {
		this.id1 = id1;
	}

	public TextField getId2() {
		return id2;
	}

	public void setId2(TextField id2) {
		this.id2 = id2;
	}

	public TextField getUser() {
		return user;
	}

	public void setUser(TextField user) {
		this.user = user;
	}

	public TextField getMima1() {
		return mima1;
	}

	public void setMima1(TextField mima1) {
		this.mima1 = mima1;
	}

	public TextField getMima2() {
		return mima2;
	}

	public void setMima2(TextField mima2) {
		this.mima2 = mima2;
	}

	public TextField getQrmm() {
		return qrmm;
	}

	public void setQrmm(TextField qrmm) {
		this.qrmm = qrmm;
	}

//	public static void main(String args[]) {
//		new_login deng = new new_login();
//	}
}
